<?php
$this->breadcrumbs = array(
	'Quản lý Người dùng',
);
?>
<!-- BEGIN PORTLET-->
<div class="row">
	<div class="col-md-12">
    	<div class="portlet">
        	<div class="portlet-title">
            	<div class="caption"><i class="icon-bar-chart"></i>Danh sách Người dùng</div>
                <div class="actions">
                    <?php echo CHtml::link('<i class="icon-plus"></i> Thêm mới', array('/Users/default/create'), array('class'=>'btn blue btn-sm')); ?>
                </div>
            </div>
            <div class="portlet-body">
<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'users-grid',
	'dataProvider'=>$model->search(),
	'ajaxUpdate'=>true,
	'filter'=>$model,
	'itemsCssClass'=>'table table-striped table-bordered table-advance table-hover',
	'pager'=>array(
        'header'=>'',
		'maxButtonCount'=>10,
        'header'=>'',
        'prevPageLabel'=>'<i class="icon-angle-left"></i></a>',
        'nextPageLabel'=>'<i class="icon-angle-right"></i></a>',
        'firstPageLabel'=>'First',
        'lastPageLabel'=>'Last',
        'footer'=>'',
		'selectedPageCssClass'=>'active',
		'hiddenPageCssClass'=>'disabled',
        'htmlOptions'=>array(
            'class'=>'pagination pagination-sm',
        ),
    ),
	'columns'=>array(
		array(
			'name'=>'id',
			'value'=>'$data->id',
			'filter'=>''
		),
		'username',
		'email',
		array(
			'name'=>'createddate',
			'value'=>'date("H:i:s d-m-Y", strtotime($data->createddate))',
		),
		array(
			'name'=>'lastlogin',
			'value'=>'date("H:i:s d-m-Y", strtotime($data->lastlogin))',
		),
		array(
			'name'=>'status',
			'value'=>'$data->status',
			'filter'=>array('A'=>'Hoạt động', 'I'=>'Ngừng hoạt động', 'P'=>'Chờ duyệt')
		),
		array(
			'class'=>'CButtonColumn',
			'header'=>'Action',
			'template'=>'{active} {banned} {view} {update} {delete}',
			'buttons'=>array
			(
				'active'=>array(
					'label'=>'<i class="icon-check"></i>',
					'imageUrl'=>false,
					'url'=>'array("/Users/default/active", "id"=>$data->id)',
					'options'=>array(
						'class'=>'btn default btn-xs purple',
						'title'=>'Kích hoạt',
					),
					'visible'=>'($data->status !== "A") ? true : false',
				),
				'banned'=>array(
					'label'=>'<i class="icon-minus-sign"></i>',
					'imageUrl'=>false,
					'url'=>'array("/Users/default/banned", "id"=>$data->id)',
					'options'=>array(
						'class'=>'btn default btn-xs red',
						'title'=>'Ngừng sử dụng'
					),
					'visible'=>'($data->status === "A") ? true : false',
				),
				'view'=>array(
					'label'=>'<i class="icon-share"></i>',
					'imageUrl'=>false,
					'options'=>array(
						'class'=>'btn default btn-xs blue',
						'title'=>'View'
					),
				),
				'update'=>array(
					'label'=>'<i class="icon-edit"></i>',
					'imageUrl'=>false,
					'options'=>array(
						'class'=>'btn default btn-xs green',
						'title'=>'Edit'
					),
				),
				'delete'=>array(
					'label'=>'<i class="icon-trash"></i>',
					'imageUrl'=>false,
					'options'=>array(
						'class'=>'btn default btn-xs black',
						'title'=>'Delete'
					),
				),
			),
			'htmlOptions'=>array(
				'width'=>'120px',
				'class'=>'text-center'
			),
		),
	),
	'htmlOptions'=>array(
		'class'=>''
	),
)); ?>
            </div>
        </div>
    </div>
</div>